import { cached } from '@/utils'
import { getEnumDict, ENUM_MAP } from './enumDict'

const tags = {
  1: 'success',
  2: 'danger'
}

export function IN_OUT_TYPES() {
  return {
    IN: '1',
    OUT: '2'
  }
}

export async function getInOutType() {
  const { data } = await getEnumDict(ENUM_MAP.inoutEnum)
  return data
}

export function inOutTag(val) {
  return cached(val => tags[val])
}
